package com.raymond.cmpp.client.handler;

import com.alibaba.fastjson.JSONObject;
import com.raymond.cmpp.client.CmppClient;
import com.raymond.cmpp.common.msg.response.TerminateResponseMessage;
import io.netty.channel.ChannelHandlerContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * 连接拆除响应
 *
 * @author :  raymond
 * @version :  V1.0
 * @date :  2021-08-05 15:54
 */
public class TerminateResponseMessageHandler extends BaseBusinessHandler<TerminateResponseMessage> {
    private final static Logger logger = LoggerFactory.getLogger(TerminateResponseMessageHandler.class);
    public TerminateResponseMessageHandler(CmppClient queueClient) {
        super(TerminateResponseMessage.class, queueClient);
    }

    @Override
    protected void channelRead(ChannelHandlerContext ctx, TerminateResponseMessage msg) throws Exception {
        logger.info("连接拆除响应:{}", JSONObject.toJSONString(msg));
        responseNotice(msg);
        ctx.channel().close();
    }
}
